{{#if scope.currentCluster.isReady}}
  {{#banner-message color="bg-warning"}}
    <p>{{t 'banner.logging' dashboardLink=scope.dashboardLink docsBase=scope.docsBase htmlSafe=true}}</p>
  {{/banner-message}}
{{/if}}

<section class="header clearfix">
  <h1 class="pull-left text-capitalize">
    {{t headerLabel}}
  </h1>
</section>

{{#if showWindowsWarning}}
  {{banner-message
    icon="icon-alert"
    color="bg-warning mb-10"
    message=(t "windowsCluster.logging.vxlanWarning" appName=settings.appName htmlSafe=true)
  }}
{{else}}
  <div class="banner bg-info">
    <div class="banner-icon p-20">
      <i class="icon icon-info"></i>
    </div>
    <div class="banner-message p-20">
      {{#if isClusterLevel}}
        {{#if isWindows}}
          {{t "windowsCluster.logging.helpText" htmlSafe=true}}
        {{else}}
          {{t "loggingPage.helpText.cluster" htmlSafe=true}}
        {{/if}}
      {{else}}
        <ul>
          <li style="list-style: circle;">
            {{#if isWindows}}
              {{t "windowsCluster.logging.helpText" htmlSafe=true}}
            {{else}}
              {{t "loggingPage.helpText.cluster" htmlSafe=true}}
            {{/if}}
          </li>
          <li style="list-style: circle;">
            {{#if (and clusterTargetType (not-eq clusterTargetType "none"))}}
              {{t
                "loggingPage.helpText.clusterTarget"
                clusterTargetType=clusterTargetType
                htmlSafe=true
              }}
            {{else}}
              {{t "loggingPage.helpText.noClusterTarget"}}
            {{/if}}
          </li>
        </ul>
      {{/if}}
    </div>
  </div>
{{/if}}

{{#if (not-eq targetType "none")}}
  <section class="header has-tabs clearfix p-0">
    <ul class="tab-nav">
      {{#if (eq targetType "customTarget")}}
        <li>
          <button
            class={{concat (if testing "btn-disabled-transparent") " btn bg-transparent"}} disabled={{testing}} type="button" {{action "cancel"}}
          >
            {{t "loggingPage.advanced.cancel"}}
          </button>
        </li>
      {{else}}
        <li>
          <button
            class="btn bg-transparent" type="button" {{action "showPaste"}}
          >
            {{t "loggingPage.advanced.file"}} <span class="icon icon-copy"></span>
          </button>
        </li>
      {{/if}}
    </ul>
  </section>
{{/if}}

{{#if (eq targetType "customTarget")}}
  <div class="mt-25">
    {{logging/input-logging-config
      showDownload=false
      canChangeName=false
      autoResize=true
      value=customContent
      model=model.customTarget
      parentModel=model
      targetType=targetType
      pageScope=pageScope
    }}
  </div>
  {{copy-to-clipboard
    tooltipText=""
    buttonText="copyToClipboard.tooltip"
    clipboardText=value
    class="with-clip"
  }}
{{else}}
  {{logging/targets-nav
    originalModel=originalModel
    targetType=targetType
    isClusterLevel=isClusterLevel
    pageScope=pageScope
  }}

  {{#if (and originalModel.showTransitioningMessage (eq originalModel.targetType targetType))}}
    <div class="banner {{originalModel.stateBackground}}">
      <div class="banner-icon p-20"><i class="icon {{originalModel.stateIcon}}"></i></div>
      <div class="banner-message p-20">
        <table>
          {{error-sub-row
            fullColspan=fullColspan
            model=originalModel
          }}
        </table>
      </div>
    </div>
  {{/if}}

  {{#if (eq targetType "elasticsearch")}}
    {{logging/target-elasticsearch
      targetType=targetType
      model=model.elasticsearch
      pageScope=pageScope
      parentModel=model
      endpointErrorText=esErrors
    }}
  {{else if (eq targetType "splunk")}}
    {{logging/target-splunk
      model=model.splunk
      parentModel=model
      targetType=targetType
    }}
  {{else if (eq targetType "kafka")}}
    {{logging/target-kafka
      model=model.kafka
      parentModel=model
      targetType=targetType
    }}
  {{else if (eq targetType "syslog")}}
    {{logging/target-syslog
      model=model.syslog
      parentModel=model
      targetType=targetType
    }}
  {{else if (eq targetType "fluentForwarder")}}
    {{logging/target-flentd
      model=model.fluentForwarder
      parentModel=model
      targetType=targetType
      endpointValidate=endpointValidate
    }}
  {{/if}}
{{/if}}

{{top-errors errors=errors}}

{{#if (not-eq targetType "none")}}
  {{logging/form-test
    test=(action "test")
    testing=testing
    tested=tested
    testOk=testOk
    model=model
    targetType=targetType
  }}
{{/if}}

<div class="footer-actions">
  {{save-cancel
    saveDisabled=saveDisabled
    cancelDisabled=true
    editing=true
    save=(action "save")
  }}
</div>
